//
//  MineCell.m
//  liangyi
//
//  Created by 张水 on 16/12/15.
//  Copyright © 2016年 yswh. All rights reserved.
//

#import "MineCell.h"

@implementation MineCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self){
        [self setup];
    }
    return  self;
}

- (void)setCellModel:(MineCellModel *)CellModel{
    
    _CellModel = CellModel;
    self.imgView.image = [UIImage imageNamed:CellModel.icon];
    self.lblName.text = CellModel.title;
}

-(void)setup{
    
    WeakSelf(wk)
    
    self.backgroundColor = [UIColor ColorWithHex:@"#333942"];
    
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    UIView *line = [UIView new];
    line.backgroundColor = [UIColor ColorWithHex:@"#2f333a"];
    [self.contentView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(wk).offset(17);
        make.bottom.right.equalTo(wk);
        make.height.equalTo(@1);
    }];
    
    self.imgView = [[UIImageView alloc]init];
    self.imgView.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.imgView];
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(wk).offset(20);
        make.top.equalTo(wk).offset(20);
        make.width.height.equalTo(@25);
    }];
    
    self.lblName = [[UILabel alloc]init];
    self.lblName.textColor = [UIColor whiteColor];
    self.lblName.font = [UIFont systemFontOfSize:20];
    self.lblName.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.lblName];
    [self.lblName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imgView.mas_right).offset(10);
        make.centerY.equalTo(self.imgView.mas_centerY);
    }];
    
    
}

@end
